#!/usr/bin/python
# -*- coding: utf-8 -*-

import unittest
import base64
import time
import datetime

from contact.common import json

from security import decode, encode

class SecurityTest(unittest.TestCase):
    
    def test_decode(self):
        pass
    
    def test_encode(self):
        d = {'now': time.time()}
        encode_data = encode(d, 'abc')
        self.assertEqual(d, decode(encode_data, 'abc'))
        print decode(encode_data, 'abc')
        print datetime.datetime.fromtimestamp(time.time())
        print datetime.datetime.utcfromtimestamp(time.time())
        
if __name__ == '__main__':
    unittest.main()